using System.Collections;
using System.Collections.Generic;
using UnityEngine;

[CreateAssetMenu(fileName = "TileDataDoor",menuName = "Custom/TileDataDoor")]
public class TileDataDoor:TileData {
	
	[SerializeField] GameObject doorPrefab;
	[SerializeField] TileDataDoor doorOther;

	public override void GetTileData(Vector3Int position,UnityEngine.Tilemaps.ITilemap tilemap,ref UnityEngine.Tilemaps.TileData tileData) {
		base.GetTileData(position,tilemap,ref tileData);
		tileData.gameObject=doorPrefab;
	}

	static readonly Vector3 offset = new Vector2(-0.5f,-0.5f);
	public override bool StartUp(Vector3Int position,UnityEngine.Tilemaps.ITilemap tilemap,GameObject go) {
		if(go!=null) {
			go.transform.position+=offset;
			Door door = go.GetComponent<Door>();
			door?.Init(doorOther,isSolid);
		}
		return base.StartUp(position,tilemap,go);
	}
}